package main

func getMax(a int, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func rob(nums []int) int {
	if len(nums) == 0 {
		return 0
	}
	dp := make([]int, len(nums))
	for i, _ := range nums {
		if i == 0 {
			dp[0] = nums[0]
		} else if i == 1 {
			dp[1] = getMax(nums[0], nums[1])
		} else {
			dp[i] = getMax(nums[i]+dp[i-2], dp[i-1])
		}
	}
	return dp[len(nums)-1]
}

func main() {
	println(rob([]int{2}))
}
